package com.rc.saas.tenant.vo.hlht;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.rc.saas.tenant.common.enums.*;
import com.rc.saas.tenant.common.utils.StringUtil;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

public class HlhtOrderPrintVo {
    @ExcelProperty("状态")
    private String status;

    @ExcelProperty("桩群")
    private String stationName;

    @ExcelProperty("互联运营商")
    private String hlhtOperatorName;

    @ExcelIgnore
    private String hlhtOrderType;

    @ExcelProperty("订单类型")
    private String hlhtOrderTypeString;

    @ExcelProperty("互联类型")
    private String hlhtTypeString;

    @ExcelProperty("所属公司")
    private String companyName;

    @ExcelProperty("枪编号")
    private String gunNo;

    @ExcelProperty("订单号")
    private String orderNum;

    @ExcelProperty("外部订单号")
    private String outOrderNum;

    @ExcelProperty("会员名")
    private String nickname;

    @ExcelProperty("手机号")
    private String mobile;

    @ExcelProperty("车牌号")
    private String carNumber;

     @ExcelProperty("充电方式")
     private String accountType;

    @ExcelProperty("开始充电时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    @ExcelProperty("结束充电时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @ExcelProperty("充电时长")
    private String lastTime;

    @ExcelProperty("电量(度)")
    private BigDecimal totalPower;

    @ExcelProperty("电费(元)")
    private BigDecimal totalElecMoney;

    @ExcelProperty("服务费(元)")
    private BigDecimal totalSeviceMoney;

    @ExcelIgnore
    private BigDecimal discountServiceAmount;

    @ExcelProperty("优惠(元)")
    private BigDecimal discountAmount;

    @ExcelProperty("总价格(元)")
    private BigDecimal totalMoney;

    @ExcelProperty("实付(元)")
    private BigDecimal payAmount;


    /**
     * 停止方式
     * 0: 用户手动停止充电；
     * 1: 客户归属地运营商平台停止充电；
     * 2: BMS 停止充电；
     * 3: 充电机网络异常；
     * 4: 连接器断开
     * 5: 电价异常
     * 6: 余额不足
     * 7: 电流过低停止
     * 8: 充满平台停止
     * 9: 充满停止
     * 10: 电池温度过高停止
     * 11: 电流过高
     * 12: 电压过高
     * 13: 订单已结算
     */
    @ExcelIgnore
    private Integer stopReason;

    @ExcelProperty("停止原因")
    private String stopReasonResult;

    @ExcelProperty("桩停充原因")
    private String pileStopReasonString;

    @ExcelIgnore
    private Integer pileStopReason;

    @ExcelProperty("开始soc")
    private BigDecimal beginSoc;
    @ExcelProperty("结束soc")
    private BigDecimal soc;
    @ExcelProperty("桩厂家")
    private String brandName;

    @ExcelIgnore
    private String orderInfoHlhtType;

    @ExcelIgnore
    private String hlhtTenantCode;

    @ExcelIgnore
    private String hlhtOperatorId;

    //@ExcelIgnore
    //private BigDecimal sharpPower;


    //    @ExcelProperty("峰时电量")
    @ExcelIgnore()
    private BigDecimal highPower;

//    @ExcelProperty("平时电量")
    @ExcelIgnore()
    private BigDecimal flatPower;

//    @ExcelProperty("谷时电量")
    @ExcelIgnore()
    private BigDecimal lowPower;

    //@ExcelIgnore
    //private BigDecimal sharpBaseAmount;

//    @ExcelProperty("峰时电费")
    @ExcelIgnore()
    private BigDecimal highBaseAmount;

//    @ExcelProperty("平时电费")
    @ExcelIgnore()
    private BigDecimal flatBaseAmount;

//    @ExcelProperty("谷时电费")
    @ExcelIgnore()
    private BigDecimal lowBaseAmount;

    //@ExcelIgnore
    //private BigDecimal sharpServiceAmount;

//    @ExcelProperty("峰时服务费")
    @ExcelIgnore()
    private BigDecimal highServiceAmount;

//    @ExcelProperty("平时服务费")
    @ExcelIgnore()
    private BigDecimal flatServiceAmount;

//    @ExcelProperty("谷时服务费")
    @ExcelIgnore()
    private BigDecimal lowServiceAmount;

    @ExcelIgnore
    private String elecServerDomain;

    public String getElecServerDomain() {
        return elecServerDomain;
    }

    public void setElecServerDomain(String elecServerDomain) {
        this.elecServerDomain = elecServerDomain;
    }

    public Integer getPileStopReason() {
        return pileStopReason;
    }

    public void setPileStopReason(Integer pileStopReason) {
        this.pileStopReason = pileStopReason;
    }

    public String getAccountType() {
        if ("0".equals(accountType)) {
            return "个人充电";
        } else if ("1".equals(accountType)) {
            return "企业充电";
        } else if ("2".equals(accountType)) {
            return "共享充电";
        }
        return accountType;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    public String getStatus() {
        if ("0".equals(status)){
            return "未充电";
        }else if("1".equals(status)){
            return "充电中";
        }else if("2".equals(status)){
            return "已完成";
        }else if("3".equals(status)){
            return "充电结算中";
        }
        return status;
    }

    //public BigDecimal getSharpPower() {
    //    return sharpPower;
    //}
    //
    //public void setSharpPower(BigDecimal sharpPower) {
    //    this.sharpPower = sharpPower;
    //}
    //
    //public BigDecimal getSharpBaseAmount() {
    //    return sharpBaseAmount;
    //}
    //
    //public void setSharpBaseAmount(BigDecimal sharpBaseAmount) {
    //    this.sharpBaseAmount = sharpBaseAmount;
    //}
    //
    //public BigDecimal getSharpServiceAmount() {
    //    return sharpServiceAmount;
    //}
    //
    //public void setSharpServiceAmount(BigDecimal sharpServiceAmount) {
    //    this.sharpServiceAmount = sharpServiceAmount;
    //}

    public String getOrderInfoHlhtType() {
        return orderInfoHlhtType;
    }

    public void setOrderInfoHlhtType(String orderInfoHlhtType) {
        this.orderInfoHlhtType = orderInfoHlhtType;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public String getGunNo() {
        return gunNo;
    }

    public void setGunNo(String gunNo) {
        this.gunNo = gunNo;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getOutOrderNum() {
        return outOrderNum;
    }

    public void setOutOrderNum(String outOrderNum) {
        this.outOrderNum = outOrderNum;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public BigDecimal getTotalPower() {
        return totalPower;
    }

    public void setTotalPower(BigDecimal totalPower) {
        this.totalPower = totalPower;
    }

    public BigDecimal getTotalElecMoney() {
        return totalElecMoney;
    }

    public void setTotalElecMoney(BigDecimal totalElecMoney) {
        this.totalElecMoney = totalElecMoney;
    }

    public BigDecimal getTotalSeviceMoney() {
        return totalSeviceMoney;
    }

    public void setTotalSeviceMoney(BigDecimal totalSeviceMoney) {
        this.totalSeviceMoney = totalSeviceMoney;
    }

    public BigDecimal getDiscountServiceAmount() {
        return discountServiceAmount;
    }

    public void setDiscountServiceAmount(BigDecimal discountServiceAmount) {
        this.discountServiceAmount = discountServiceAmount;
    }

    public String getLastTime() {
        Date date = new Date();
        if (this.getEndTime() != null && this.getStartTime() != null) {
            long l = this.getEndTime().getTime() - this.getStartTime().getTime();
            SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
            //八个小时的时差
            date.setTime(l - (1000 * 60 * 60 * 8));
            String format = sdf.format(date);
            return format;
        } else {
            return null;
        }
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public BigDecimal getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public BigDecimal getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
    }

    public Integer getStopReason() {
        return stopReason;
    }

    public void setStopReason(Integer stopReason) {
        this.stopReason = stopReason;
    }

    public String getStopReasonResult() {
        if (this.stopReason != null){
            switch (this.stopReason){
                case 0: return "用户手动停止充电";
                case 1: return "客户归属地运营商平台停止充电";
                case 2: return "BMS 停止充电";
                case 3: return "充电机网络异常";
                case 4: return "连接器断开";
                case 5: return "电价异常";
                case 6: return "余额不足";
                case 7: return "电流过低停止";
                case 8: return "充满平台停止";
                case 9: return "充满停止";
                case 10: return "电池温度过高停止";
                case 11: return "电流过高";
                case 12: return "电压过高";
                case 13: return "订单已结算";
                default: return stopReasonResult;
            }
        }else {
            return stopReasonResult;
        }
    }

    public void setStopReasonResult(String stopReasonResult) {
        this.stopReasonResult = stopReasonResult;
    }

    public String getPileStopReasonString() {
        if ("SH_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = ShStopReasonEnum.getStopReasonMsg(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("LNC_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = LncStopReasonEnum.getLncStopReasonEnumByTenant(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("JN_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = JnStopReasonEnum.getMsgJnStopReason(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("YL_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = YlStopReasonEnum.getStopReasonMsg(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("YC_DOMAIN".equals(elecServerDomain) || "ZC_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = ZcElecPileStopReasonEnum.getElecPileStopReasonResultWithInt(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("RS_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = RsStopReasonEnum.getStopReasonResultWithInt(this.getPileStopReason().toString());
            return stopReasonMsg;
        } else if ("YKR_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = YkrPileStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return stopReasonMsg;
        } else if ("JUN_DOMAIN".equals(elecServerDomain)) {
            String stopReasonMsg = JunStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return stopReasonMsg;
        } else {
            //桩停止原因
            String elecPileStopReasonResult = ElecPileStopReasonEnum.getElecPileStopReasonResult(this.getPileStopReason());
            return elecPileStopReasonResult;
        }
    }

    public void setPileStopReasonString(String pileStopReasonString) {
        this.pileStopReasonString = pileStopReasonString;
    }

    public BigDecimal getBeginSoc() {
        return beginSoc;
    }

    public void setBeginSoc(BigDecimal beginSoc) {
        this.beginSoc = beginSoc;
    }

    public BigDecimal getSoc() {
        return soc;
    }

    public void setSoc(BigDecimal soc) {
        this.soc = soc;
    }

    public BigDecimal getHighPower() {
        return highPower;
    }

    public void setHighPower(BigDecimal highPower) {
        this.highPower = highPower;
    }

    public BigDecimal getFlatPower() {
        return flatPower;
    }

    public void setFlatPower(BigDecimal flatPower) {
        this.flatPower = flatPower;
    }

    public BigDecimal getLowPower() {
        return lowPower;
    }

    public void setLowPower(BigDecimal lowPower) {
        this.lowPower = lowPower;
    }

    public BigDecimal getHighBaseAmount() {
        return highBaseAmount;
    }

    public void setHighBaseAmount(BigDecimal highBaseAmount) {
        this.highBaseAmount = highBaseAmount;
    }

    public BigDecimal getFlatBaseAmount() {
        return flatBaseAmount;
    }

    public void setFlatBaseAmount(BigDecimal flatBaseAmount) {
        this.flatBaseAmount = flatBaseAmount;
    }

    public BigDecimal getLowBaseAmount() {
        return lowBaseAmount;
    }

    public void setLowBaseAmount(BigDecimal lowBaseAmount) {
        this.lowBaseAmount = lowBaseAmount;
    }

    public BigDecimal getHighServiceAmount() {
        return highServiceAmount;
    }

    public void setHighServiceAmount(BigDecimal highServiceAmount) {
        this.highServiceAmount = highServiceAmount;
    }

    public BigDecimal getFlatServiceAmount() {
        return flatServiceAmount;
    }

    public void setFlatServiceAmount(BigDecimal flatServiceAmount) {
        this.flatServiceAmount = flatServiceAmount;
    }

    public BigDecimal getLowServiceAmount() {
        return lowServiceAmount;
    }

    public void setLowServiceAmount(BigDecimal lowServiceAmount) {
        this.lowServiceAmount = lowServiceAmount;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getHlhtOperatorName() {
        return hlhtOperatorName;
    }

    public void setHlhtOperatorName(String hlhtOperatorName) {
        this.hlhtOperatorName = hlhtOperatorName;
    }

    public String getHlhtOrderType() {
        return hlhtOrderType;
    }

    public void setHlhtOrderType(String hlhtOrderType) {
        this.hlhtOrderType = hlhtOrderType;
    }

    public void setHlhtOrderTypeString(String hlhtOrderTypeString) {
        this.hlhtOrderTypeString = hlhtOrderTypeString;
    }

    public void setHlhtTypeString(String hlhtTypeString) {
        this.hlhtTypeString = hlhtTypeString;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getHlhtOrderTypeString() {
        if ("0".equals(orderInfoHlhtType)) {
            if ("0".equals(hlhtOrderType)) {
                return "自有订单";
            } else if ("1".equals(hlhtOrderType)) {
                return "反向订单";
            } else if ("2".equals(hlhtOrderType)) {
                return "正向订单";
            }
        } else if ("1".equals(orderInfoHlhtType)) {
            if ("1".equals(hlhtOrderType)) {
                return "反向订单";
            } else if ("2".equals(hlhtOrderType)) {
                return "正向订单";
            }
        } else if ("2".equals(orderInfoHlhtType)) {
            return "正向订单";
        } else if ("3".equals(orderInfoHlhtType)) {
            return "正向内部外联订单";
        }
        return "";
    }

    public String getHlhtTypeString() {
        if ("0".equals(orderInfoHlhtType)) {
            if ("0".equals(hlhtOrderType)) {
                return "";
            } else if (StringUtil.isNotBlank(hlhtTenantCode) && !StringUtil.isNotBlank(hlhtOperatorId)) {
                return "内部互联";
            } else {
                return "外部互联";
            }
        } else if ("1".equals(orderInfoHlhtType)) {
            return "内部互联";
        } else if ("3".equals(orderInfoHlhtType)) {
            return "外部互联";
        } else {
            return "内部互联";
        }
    }

    public String getHlhtTenantCode() {
        return hlhtTenantCode;
    }

    public void setHlhtTenantCode(String hlhtTenantCode) {
        this.hlhtTenantCode = hlhtTenantCode;
    }

    public String getHlhtOperatorId() {
        return hlhtOperatorId;
    }

    public void setHlhtOperatorId(String hlhtOperatorId) {
        this.hlhtOperatorId = hlhtOperatorId;
    }
}
